package po;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Order {

    private Integer id;         // 主键 id

    private Product product;    // 关联的产品信息

    private Admin admin;        // 关联的管理员信息

    private Student student;    // 关联的学生信息

    private Double totalMoney;  // 总花费

    private Date createTime;    // 创建订单时间 非空

    private Date endTime;       // 订单到期时间 非空

    private Date renewTime;       // 订单缴费时间 非空

    private Date updateTime;    // 修改订单时间 非空

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Admin getAdmin() {
        return admin;
    }

    public void setAdmin(Admin admin) {
        this.admin = admin;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public Double getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(Double totalMoney) {
        this.totalMoney = totalMoney;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getRenewTime() {
        return renewTime;
    }

    public void setRenewTime(Date renewTime) {
        this.renewTime = renewTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return "Order{" +
                "id=" + id +
                ", product=" + product +
                ", admin=" + admin +
                ", student=" + student +
                ", totalMoney=" + totalMoney +
                ", createTime=" + dateFormat.format(createTime) +
                ", endTime=" + dateFormat.format(endTime) +
                ", renewTime=" + dateFormat.format(renewTime) +
                ", updateTime=" + dateFormat.format(updateTime) +
                '}';
    }
}
